package com.gec.teams.wechat.util;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.gec.teams.wechat.config.SystemConstants;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 功能：
 * 作者：YumTea
 * 日期：2024/6/21 15:11
 */
@Component
@Data
public class SysDateTime {
    @Autowired
    private SystemConstants systemConstants;
    public DateTime attendanceStart;
    public DateTime work;
    public DateTime attendanceEnd;
    public DateTime closeStart;
    public DateTime down;
    public DateTime closeEnd;
    @PostConstruct
    public void init() {
        if(systemConstants==null) System.out.println("出问题了");
        this.attendanceStart= DateUtil.parse(systemConstants.attendanceStartTime);
        //上班考勤时间结束
        this.attendanceEnd = DateUtil.parse( systemConstants.attendanceEndTime);
        //下班考勤开始
        this.closeStart = DateUtil.parse( systemConstants.closingStartTime);
        //下班考勤结束
        this.closeEnd = DateUtil.parse( systemConstants.closingEndTime);
        //下班时间
        this.down = DateUtil.parse(systemConstants.closingTime);//下班时间
        //上班时间
        this.work=DateUtil.parse(systemConstants.attendanceTime);//开始上班
    }
}
